/**
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company: gzhc365 </p>
 */
package cn.midi365.train.common.helper;

import org.apache.commons.lang3.time.DateUtils;

import com.eteam.common.utils.DateHelper;

/**
 * Description: TODO {一句话描述类是干什么的}<br/>
 *
 * @author zihong
 * @date: 2017年9月17日 下午5:45:01
 * @version 1.0
 * @since JDK 1.7
 */
public class OrderIDFormat {
    public static long format(long idValue) {
        if (idValue != 0 && idValue != -1) {
            StringBuilder sBuilder = new StringBuilder();
            String sequence = String.format("%04d", idValue);
            String idPrefix = DateHelper.getHssCurrentDate();
            sBuilder.append(idPrefix).append(sequence);
            return Long.valueOf(sBuilder.toString());
        }
        throw new RuntimeException("the generate id cache has not be init.");
    }

}
